{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# LC-3 Changes, Dec 1\n", "\n", "* Fixed JSRR BASE\n", "* Added .STRINGC\n", "\n", "## Fixed JSRR BASE" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Assembled! Use %dis or %dump to examine.\n" ] } ], "source": [ ".ORIG x3000\n", " LEA R2, HERE\n", " JSRR R2\n", " HALT\n", "HERE:\n", " RET\n", ".END" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "============================================================\n", "Memory disassembled:\n", "============================================================\n", " x3000: xE402 LEA R2, HERE [line: 1]\n", " x3001: x4080 JSRR R2 [line: 2]\n", " x3002: xF025 HALT [line: 3]\n", "HERE: x3003: xC1C0 RET [line: 5]\n" ] } ], "source": [ "%dis" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "============================================================\n", "Computation completed\n", "============================================================\n", "Instructions: 4\n", "Cycles: 28 (0.000014 milliseconds)\n", "\n", "============================================================\n", "Registers:\n", "============================================================\n", "PC: x048E\n", "N: 0 Z: 0 P: 1 \n", "R0: x0000 R1: x0000 R2: x3003 R3: x0000 \n", "R4: x0000 R5: x0000 R6: x0000 R7: x3003 \n" ] } ], "source": [ "%exe" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## .STRINGC" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Assembled! Use %dis or %dump to examine.\n" ] } ], "source": [ ".ORIG x3000\n", " .FILL #1\n", "DATA: .STRINGZ \"a\"\n", " .FILL #2\n", ".END" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "============================================================\n", "Memory dump:\n", "============================================================\n", " x3000: x0001\n", " x3001: x0061\n", " x3002: x0000\n", " x3003: x0002\n" ] } ], "source": [ "%dump" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Assembled! Use %dis or %dump to examine.\n" ] } ], "source": [ ".ORIG x3000\n", " .FILL #1\n", "DATA: .STRINGC \"a\"\n", " .FILL #2\n", ".END" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "============================================================\n", "Memory dump:\n", "============================================================\n", " x3000: x0001\n", " x3001: x0061\n", " x3002: x0000\n", " x3003: x0002\n", " x3004: x0000\n" ] } ], "source": [ "%dump" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Assembled! Use %dis or %dump to examine.\n" ] } ], "source": [ ".ORIG x3000\n", " .FILL #1\n", "DATA: .STRINGZ \"ab\"\n", " .FILL #2\n", ".END" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "============================================================\n", "Memory dump:\n", "============================================================\n", " x3000: x0001\n", " x3001: x0061\n", " x3002: x0062\n", " x3003: x0000\n", " x3004: x0002\n" ] } ], "source": [ "%dump" ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Assembled! Use %dis or %dump to examine.\n" ] } ], "source": [ ".ORIG x3000\n", " .FILL #1\n", "DATA: .STRINGC \"ab\"\n", " .FILL #2\n", ".END" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "============================================================\n", "Memory dump:\n", "============================================================\n", " x3000: x0001\n", " x3001: x6261\n", " x3002: x0000\n", " x3003: x0002\n", " x3004: x0002\n", " x3005: x0000\n" ] } ], "source": [ "%dump" ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Assembled! Use %dis or %dump to examine.\n" ] } ], "source": [ ".ORIG x3000\n", " LEA R0, DATA\n", " PUTSP\n", " HALT\n", "DATA: .STRINGC \"abcdefg\"\n", ".END" ] }, { "cell_type": "code", "execution_count": 13, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "============================================================\n", "Memory dump:\n", "============================================================\n", " x3000: xE002\n", " x3001: xF024\n", " x3002: xF025\n", " x3003: x6261\n", " x3004: x6463\n", " x3005: x6665\n", " x3006: x0067\n", " x3007: x0000\n", " x3008: x0000\n" ] } ], "source": [ "%dump x3000 x3008" ] }, { "cell_type": "code", "execution_count": 14, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "abcdefg============================================================\n", "Computation completed\n", "============================================================\n", "Instructions: 304\n", "Cycles: 2047 (0.001024 milliseconds)\n", "\n", "============================================================\n", "Registers:\n", "============================================================\n", "PC: x048E\n", "N: 0 Z: 0 P: 1 \n", "R0: x3003 R1: x0000 R2: x0000 R3: x0000 \n", "R4: x0000 R5: x0000 R6: x0000 R7: x3003 \n" ] } ], "source": [ "%exe" ] } ], "metadata": { "kernelspec": { "display_name": "Calysto LC3", "language": "gas", "name": "calysto_lc3" }, "language_info": { "codemirror_mode": { "name": "gas", "version": 3 }, "file_extension": ".asm", "mimetype": "text/x-gas", "name": "gas" } }, "nbformat": 4, "nbformat_minor": 0 }